

var gulp    = require('gulp'),
    less    = require('gulp-less'),
    autoprefixer = require('gulp-autoprefixer'),
    jshint = require('gulp-jshint'),
    plumber = require('gulp-plumber');
    // browserSync = require("browser-sync");//浏览器自动刷新


    gulp.task('less',function() {
        gulp.src(['less/**/*.less', '!less/common/module.less'])
            .pipe(plumber())
            .pipe(less())
            .pipe(autoprefixer({
                browsers: ['last 2 versions', 'last 2 Explorer versions', 'Firefox ESR', 'Opera 12.1']
            }))
            .pipe(gulp.dest('css/'));
            // .pipe(browserSync.stream());
    });


    var SRC = 'src';
    var DEST = 'dist';

    // gulp.task("serve", ["less"], function() {
    //     browserSync.init({
    //         files: "**",
    //         server: {
    //             baseDir: "./"
    //         }
    //     });

    //     gulp.watch('less/**/*.less', ["less"]);
    //     gulp.watch('html/**/*.html').on("change", function() {
    //         browserSync.reload;
    //     });
    // });

gulp.task('lint', function() {
    gulp.src('js/test.js')
        .pipe(jshint())
        .pipe(jshint.reporter('default'));
});

gulp.task('watch',function(){
    gulp.watch('less/**/*.less',['less'])
});